/*
 *
 * Copyright 2017-2018. All rights reserved.
 *
 * This copyrighted material is made available to anyone wishing to use, modify,
 * copy, or redistribute it subject to the terms and conditions of the GNU
 * Lesser General Public License, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this distribution; if not, see <http://www.gnu.org/licenses/>.
 *
 */
package com.loveprogrammer.eternity.enums;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;

/**
 * 种族
 *
 * @author eric
 * @version 1.0.0
 */
public enum PassiveOpportunityTypeEnum {

    ACTIVE(0, "主动技能"),
    AURA(1, "光环技能，可叠加"),
    DAMAGE(2, "攻击伤害增幅被动技能，例如增加对不死族的伤害等，可叠加"),
    DEFENSE(3, "防御型被动技能，例如减少伤害，反弹伤害，等等，可叠加"),
    FIXED(99, "固定属性提升");

    private Integer code;

    private String desc;

    PassiveOpportunityTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static PassiveOpportunityTypeEnum getByCode(int code){
        Optional<PassiveOpportunityTypeEnum> optional =
                Arrays.stream(PassiveOpportunityTypeEnum.values())
                        .filter(v -> Objects.equals(v.getCode(), code))
                        .findFirst();

        return optional.orElse(PassiveOpportunityTypeEnum.ACTIVE);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
